Let's begin with
understanding RabbitMQ. It is one of the most popular open source message
brokers that gives all applications
a common platform to send and receive messages. Here, the messages get a safe place to live
until received. RabbitMQ is lightweight and easy to deploy on-premises
and in the Cloud. It supports multiple
messaging protocols, such as Advanced Message
Queuing Protocol or AMQP, Simple Text Oriented
Messaging Protocol or STAMP, Message Queuing Telemetry
Transport or MQTT and HTTP. RabbitMQ can be deployed in distributed and federated
configurations to meet high-scale, high
availability requirements. This messaging system uses AMQP 0.9.1 as the basis for a set of standards controlling the
entire message passing process. It is implemented in Erlang/OTP, which is a technology
tailored for building stable, reliable, fault tolerant, and highly scalable systems. Here you'll learn about
the features of RabbitMQ. RabbitMQ provides
reliable delivery to ensure that messages are always delivered even in case of encountering failures
of various kinds. It provides flexible
routing with built-in exchange types for
the typical routing logic. Clustering of several RabbitMQ
servers is also possible. The Federation Model is therefore loosely
connected servers. Highly available queues are also available by
mirroring queues. RabbitMQ supports multiple
protocols such as AMQP, HTTP, and STAMP. Many RabbitMQ clients are available for almost any
programming language. It also supports
tracing to find what's going on if messaging
system misbehaves. The management UI can be used to monitor and
control the broker, and it has a plug-in system to extend the core
broker functionality. RabbitMQ accepts and forwards messages like the mail
service of a post-office. Mails are sent from a
sender or producers. In this example, those
are mails from sender1, sender2, and sender3. The post box is the RabbitMQ server that maintains the queues
of messages in it. The receiver is the consumer
who waits to receive the messages from
a sender such as mail dispatch to receiver1, receiver2, and receiver3. Producing simply means sending. A program that sends
messages is a producer. The symbol of the
producer is as shown. A queue is a name for a post box that lives
inside RabbitMQ. The messages flow through
RabbitMQ and your applications. You can store them
only in a queue. A queue is bound by the host's
memory and disk limits. It is essentially a
large message buffer. Many producers can send
messages that go to one queue and many consumers can try to receive data from one queue. The symbol of the
queue is as shown. Consuming has a similar
meaning to receiving. A consumer is a program that mostly waits to
receive messages. The symbol of the
consumer is as shown. It is important to note that
in RabbitMQ terminology, the producer, consumer, and broker do not all have
to be on the same host. In most applications they don't. An application can be both
a producer and a consumer. Let's understand
the architecture of RabbitMQ message queue. Producers are client
applications that create messages and deliver
them to the broker, which is the message queue. Consumers are other applications that connect to the queue and subscribe to the messages that are to be processed
to the broker. Any software can
act as a producer, a consumer or both as a consumer and
producer of messages. Messages placed onto
the queue are stored in the queue and available until the consumer
retrieves them. Let's discuss about a general
message bus of RabbitMQ. Here, the producer service
is the producer of messages. Messages are not directly
published to a queue. The producer sends
messages to an exchange. Exchanges are message routing agents responsible for routing the messages to different queues with the help of
header attributes, bindings, and routing keys. If no exchange is mentioned, RabbitMQ uses the default
exchange as shown in this case. Messages from the default
exchange are then sent to services
such as Service1, Service2, Service3,
and Service4. At last, the messages are received by Consumer Service1, Consumer Service2, Consumer Service3, and Consumer Service4.